﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Kooboo.Commerce.Contexts.Categories;
using Kooboo.Commerce.Contexts.Products;

namespace Kooboo.Commerce.Services
{
    public class CategoryService:ServiceBase
    {
        public IEnumerable<ICategory> GetAllCategories()
        {
            return this.Actor.QueryCategories();
        }

        public IEnumerable<ICategory> GetCategoriesByProductId(int id)
        {
            return this.Actor.QueryProducts()
                .Where(i => i.Id == id)
                .FirstOrDefault()
                .Categories;
        }
    }
}
